package com.liang.pattern.store.impl;

import com.alibaba.fastjson.JSON;
import com.liang.pattern.store.ICommodity;
import org.itstack.demo.design.card.IQiYiCardService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * @author lsm
 * @ClassName IQYCardCommodity.java
 * @Description 爱奇艺礼品卡
 * @createTime 2023年11月29日 14:50:00
 */
public class IQYCardCommodity implements ICommodity {

    Logger logger = LoggerFactory.getLogger(IQYCardCommodity.class);

    //模拟注入
    private IQiYiCardService iQiYiCardService = new IQiYiCardService();

    @Override
    public void sendCommodity(String uId, String commodityId, String bizId, Map<String, String> extMap) {
        //根据uid获取手机号
        iQiYiCardService.grantToken(queryNumberByUid(uId),bizId);
        logger.info("请求参数[爱奇艺兑换卡] => uId：{} commodityId：{} bizId：{} extMap：{}", uId, commodityId, bizId, JSON.toJSON(extMap));
        logger.info("测试结果[爱奇艺兑换卡]：success");
    }

    private String queryNumberByUid(String uId){
        return "18377265578";
    }
}
